import { getGoodsType } from '@/api/goodsInfo'
import { ref } from 'vue'

export default () => {
  // 产品分类列表
  const goodTypeOptions = ref<Array<GoodTypeOptions>>([])

  // 获取产品分类加载
  const getGoodTypeOptionsLoading = ref(false)

  /**
   * 获取产品分类
   */
  const getGoodTypeOptions = async () => {
    getGoodTypeOptionsLoading.value = true
    const res = await getGoodsType()
    getGoodTypeOptionsLoading.value = false
    goodTypeOptions.value = res.data.data.rows
  }

  return {
    goodTypeOptions,
    getGoodTypeOptionsLoading,
    getGoodTypeOptions,
  }
}
